/*
 * TA++ Copyright (c) 2008-2009, Wei Dong  wdong.pku@gmail.com
 * All rights reserved.
 *
 * FOR PERSONAL AND NON-COMMERCIAL USE ONLY.  REDISTRIBUTION IS NOT PERMITTED.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 */

/**
 * \file example.cpp
 *
 * \brief Example program.
 */

#include "ta++.h"
#include "ta++-plot.h"

// All TA++ symbols are under the namespace tapp.
using namespace tapp;

int main ()
{
    // Initialize the TA-Lib.  This function is from TA-lib.
    TA_Initialize();

    // Load stock data from the file "C".
    // Records before the date 2008-05-01 are not loaded.
    Candles candles("C", str2time("2008-05-01"));

    // GnuplotChart generate gnuplot scripts.  The output will be stored in "C.gp".
    // The constructor automatically generate two panes: pane0 for the candles and
    // pane1 for volume.
    //
    // c.gp is the output Gnuplot script name
    // c.png is the image file that should be generated by running the Gnuplot script.
    GnuplotChart chart("C", "c.gp", "c.png");
    chart.addPane("")->drawCandles(candles);
    // Generate the output.
    chart.render();

    TA_Shutdown();
    return 0;
}

